var ThornScript = (function (_super) {

    function ThornScript() {
        ThornScript.super(this);
        this.thorn = null;
        this.startRotate = 0;
        this.rotateNow = 0;
        this.maxRotate = 0;
        this.minRotate = 0;
        this.startAngle = 0;
        this.floorIndex = 0;
        this.groundIndex = 0;
        this.thornIndex = 0;
        this.changeRotate = 1;
    }
    
    Laya.class(ThornScript, "ThornScript", _super);


    ThornScript.prototype._load = function (owner) {
        this.thorn = owner;
    }

    /**
     * 脚本帧循环更新
     */
    ThornScript.prototype._update = function (state) {
        if(GameSceneObj.isPause) return;
        if(this.rotateNow >= this.maxRotate){
            this.changeRotate = -1.5;
        }
        if(this.rotateNow <= this.minRotate + 30){
            this.changeRotate = 1.5;
        }
        this.rotateNow += this.changeRotate;
        this.thorn.transform.rotate(new Laya.Vector3(0,this.changeRotate,0), true, false);
        if(
            GameSceneObj.floorArr.length > this.floorIndex 
            && GameSceneObj.floorArr[this.floorIndex].length > this.groundIndex 
            && GameSceneObj.floorArr[this.floorIndex][this.groundIndex]._thorn_arr.length > this.thornIndex
        ){
            var thornObj = GameSceneObj.floorArr[this.floorIndex][this.groundIndex]._thorn_arr[this.thornIndex];
            thornObj._rotate += this.changeRotate;
        }
        
  
    }
    ThornScript.prototype.setBaseData = function (startRotate,maxRotate,minRotate,floorIndex,groundIndex,thornIndex) {
        this.startRotate = startRotate;
        this.rotateNow = startRotate;
        this.maxRotate = maxRotate;
        this.minRotate = minRotate;
        this.floorIndex = floorIndex;
        this.groundIndex = groundIndex;
        this.thornIndex = thornIndex;
    }

    return ThornScript;
})(Laya.Script);